有時候我們會需要知道 Request 是來自於哪裡 , 以便資訊的收集或者除錯 ,
例如只有某個來源的 Request , 因為傳送了錯誤的資訊而導致錯誤 ,
因此我們會想知道對方是誰 , 尤其是面對內部系統 ,
但是在 Application Insight 預設設定下 , 不會去揭露 Request 的IP資訊 ,
Starting February 5, 2018, Application Insights will set all octets of the IP address collected by client/server side SDKs to Zero after looking up the City, Country and other geo location attributes. This strengthens privacy and is a change from the prior processing that set the last octet to Zero.
This change is being made to address customer concerns with IP address and the impact of GDPR.
Note:
• If you need the first 3 octets of the IP address, you can use telemetry initializer to add a custom attribute.
• This does not affect data collected prior to February 5, 2018.
這個部份我們需要直接修改 Application Insight 的 ARM Template ,
到 Application Insight 的左邊選單 Automation 中選擇 Export Template ,
接著選擇 Deploy(這不會真的做甚麼佈署的動作)
編輯 Template
在 JSON 裡面的 Resource 節點的 Properties 下 , 新增 "DisableIpMasking": true
儲存完之後需要等待幾分鐘才能生效